package com.healthshare;



import java.text.DecimalFormat;

import cn.domob.android.ads.DomobAdView;

import com.healthshare.activity.news.ActicleActivity;
import com.healthshare.activity.news.ActicleListActivity;
import com.healthshare.activity.news.FavoriteActivity;
import com.healthshare.activity.news.HelpInfoAct;
import com.healthshare.activity.news.PublishActivity;
import com.healthshare.activity.news.WebViewActivity;
import com.healthshare.busi.login.RegistBusi;
import com.healthshare.busi.news.AppListBusi;
import com.healthshare.busi.news.HealthNewsBusi;
import com.healthshare.busi.news.NewsClassBusi;
import com.healthshare.common.modal.CChannel;
import com.healthshare.common.modal.PChannel;
import com.healthshare.parse.icenter.RegistParse;
import com.healthshare.parse.news.AppListParse;
import com.healthshare.parse.news.AppListParse.AppItem;
import com.healthshare.parse.news.HealthNewsParse;
import com.healthshare.parse.news.NewsListParse.NewsLisItem;
import com.healthshare.tool.GlobalData;
import com.mobclick.android.MobclickAgent;
import com.palmedia.framework.business.BaseBusi;
import com.palmedia.framework.business.LoadImageTsk;
import com.palmedia.framework.common.ImageDownLoadListener;
import com.palmedia.framework.config.FrameworkConfig;
import com.palmedia.framework.config.LocalData;
import com.palmedia.framework.myinterface.UiCallBack;
import com.palmedia.framework.network.IHttpConnect;
import com.palmedia.framework.ui.CustomListView;
import com.palmedia.framework.ui.CustomMessageShow;
import com.palmedia.framework.util.Util;
import com.palmedia.framework.zmfile.ZMFile;
import com.palmedia.framework.zmfile.ZMFilePath;
import com.umeng.fb.NotificationType;
import com.umeng.fb.UMFeedbackService;
import com.waps.AppConnect;
import com.waps.UpdatePointsNotifier;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Handler;
import android.telephony.TelephonyManager;
import android.util.Log;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.Button;
import android.widget.HorizontalScrollView;
import android.widget.LinearLayout;
import android.widget.TextView;


//友盟;4fb1c05252701571b700004f

//多盟：Publisher ID：	56OJzw3IuM1NuHanZg

//http://www.devdiv.com/Android-%E5%8A%A8%E6%80%81%E6%94%B9%E5%8F%98RadioButton%E8%A2%AB%E9%80%89%E6%8B%A9%E6%97%B6%E7%9A%84%E8%83%8C%E6%99%AF%E6%9C%89%E4%BB%80%E4%B9%88%E5%A5%BD%E6%96%B9%E6%B3%95%EF%BC%9F-thread-78780-1-1.html
public class HealthShareActivity extends Activity  implements UiCallBack ,OnClickListener,ImageDownLoadListener,DialogInterface.OnClickListener,UpdatePointsNotifier{

   
	private PChannel[] pchanels;
	
	//private HashMap<String,ArrayList<NewsLisItem>> newsListItems = new HashMap<String,ArrayList<NewsLisItem>>();
	//private ProgressBar progressBar;
	
	private int currentTabIndex = 0;
	
	private boolean isfirst=true;
	/**
	 * 广告
	 */
	//private LinearLayout advview;
	
	
	/**
	 * 底层栏目
	 */
	private LinearLayout buttonboard;
	
	
	/**
	 * 2级频道列表
	 */
	private CustomListView channelview; 
	
	private HorizontalScrollView hsv;
	
	
	private AppListParse applistParse;
	/**
	 * 软件推荐提醒
	 */
	private AlertDialog dialog;
	//public static int starttime=0;
	
	//推荐软件
	AppItem  recommendAppItem; 
	
	
	private String currentName;//保存当前积分的名称  
    public static  int point;//保存当前您的积分数
    public static final int consumePoint=40;
    final Handler mHandler = new Handler();
    String getPointError;
	public void onCreate(Bundle savedInstanceState) 
    {
    	//Document jp = org.jsoup.Jsoup.parse("asdf");;
		super.onCreate(savedInstanceState);
    	MobclickAgent.onError(this);
    	MobclickAgent.setUpdateOnlyWifi(false);
        MobclickAgent.update(this);
        UMFeedbackService.enableNewReplyNotification(this, NotificationType.NotificationBar);
        MobclickAgent.updateOnlineConfig(this);
    	FrameworkConfig.getInst(this,R.raw.zmconfig);//获取配置文件
		ZMFilePath.APPROOT="healthShare";//设置应应用跟目录
    	IHttpConnect.mainActivity=this;
    	
    	GlobalData.getInst();
    	setContentView(R.layout.newsmain);
    	DomobAdView domob = (DomobAdView) findViewById(R.id.domobAdXML);
    	String kvalue =  MobclickAgent.getConfigParams(this, "advalidate");
    	if(null!=kvalue && kvalue.equals("true"))
    	{
    		domob.setVisibility(View.VISIBLE);
    	}
    	else
    	{
    		domob.setVisibility(View.GONE);
    	}
    	AppConnect.getInstance(this);
    	
    	
    	//domob.setKeyword("app");
    	//domob.
    	/*String times = LocalData.getInst().getLocalValue("starttime");
    	if(times!=null)
    	{
    		try
    		{
    			starttime=Integer.parseInt(times);
    		}
    		catch(NumberFormatException num)
    		{
    			Log.i("HealthShareActivity", "NumberFormatException");
    		}
    	}
    	starttime++;
    	LocalData.getInst().setLocalValue("starttime", starttime+"");
    	 */
    	channelview= (CustomListView) findViewById(R.id.channelview);
		 
    	channelview.setOnItemClickListener(new OnItemClickListener(){

			@Override
			public void onItemClick(AdapterView<?> arg0, View v, int arg2,
					long arg3)
			{
				// TODO Auto-generated method stub
				TextView Tt = (TextView)v;
				Bundle bundle=new Bundle();
				Intent intent=new Intent();
				intent.putExtra("bundle",bundle);
				CChannel nli = (CChannel)v.getTag();
				bundle.putString("listid",nli.cid+"");
				bundle.putString("title",Tt.getText().toString());
			   	intent.setClass(HealthShareActivity.this,ActicleListActivity.class);
			   	HealthShareActivity.this.startActivity(intent);
			}
    		
    	});
    	//channelview.setOnItemSelectedListener(listener);
    	buttonboard = (LinearLayout) findViewById(R.id.buttonboard);
    	hsv= (HorizontalScrollView) findViewById(R.id.hsv);
    	hsv.setHorizontalScrollBarEnabled(false);
    	
    	((Button)this.findViewById(R.id.rightbutton)).setVisibility(View.VISIBLE);
        ((Button)this.findViewById(R.id.rightbutton)).setTextColor(Color.rgb(0,139,0));
        
        Button publis=  ((Button)this.findViewById(R.id.backbutton));
        publis.setVisibility(View.VISIBLE);
        publis.setTextColor(Color.rgb(0,139,0));
        publis.setText("发布曝光");
        ZMFilePath newsPath = new ZMFilePath();
		newsPath.addFileName("healthnews");
		boolean exist= ZMFile.fileExist(newsPath.toString());//.getSize(newsPath.toString());
		if(exist)
		{
			//ZMFile.delFile(newsPath.toString());
			//ZMFile.write(newsPath.toString(), data, 0, data.length, 0);
			byte[]buff = ZMFile.readAll(newsPath.toString());
			if(buff!=null && buff.length>0)
			{
				HealthNewsParse ncp = new HealthNewsParse();
				ncp.Parse(buff);
				pchanels =ncp.pchanels;
				if(null==pchanels)
				{
					reqHealthNewsBusi();
				}
				else
				{
					updateHealthNewsUI();
				}
			}
			else
			{
				reqHealthNewsBusi();
			}
		}
		else
		{
			reqHealthNewsBusi();
		}
    	
		if(LocalData.getInst().getLocalValue("userid")==null)
		{
			RegistBusi rb =new RegistBusi(this);
			rb.imei=this.getImei();
			rb.iExecute();
		}
		
		
    }
    
    
    
    
    /**
	 * @author xudeliang
	 * 请求1级分类数据
	 */
	/*private void reqNewsClass()
	{
		NewsClassBusi  ncb = new NewsClassBusi(this);
		ncb.iExecute();
		CustomMessageShow.getInst().showProgressDialog(this);
		//ncb=null;
	}*/
	
	/**
	 * @author xudeliang
	 * 请求健康资讯
	 */
	private void reqHealthNewsBusi()
	{
		HealthNewsBusi  ncb = new HealthNewsBusi(this);
		ncb.iExecute();
		CustomMessageShow.getInst().showProgressDialog(this);
		//ncb=null;
	}
	
	/**
	 * @author xudeliang
	 * 请求applist
	 */
	private void reqAppListBusi()
	{
		AppListBusi  ncb = new AppListBusi(this);
		ncb.iExecute();
		//CustomMessageShow.getInst().showProgressDialog(this);
		//ncb=null;
	}
	
	
	/**
	 * @author xudeliang
	 * 构造频道按钮
	 */
	private Button buildChannelButton(PChannel ns)
	{
		Button news=new Button(this);
		news.setBackgroundResource(R.drawable.buttonstyle);
		//news.setId(ns.index);
		news.setText(ns.channelname);
	    news.setTag(ns);
	    news.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18);
	    news.setOnClickListener(this);
	    
	    LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
		lp.gravity=Gravity.CENTER;
		lp.leftMargin=Util.dip2px(this, 4);
		lp.rightMargin=Util.dip2px(this, 4);
		buttonboard.addView( news, lp);
		news.setOnClickListener(this);
		return news;
	}
	
	/**
	 * @author xudeliang
	 * 更新新闻ui
	 */
	private void updateHealthNewsUI()
	{
		int index1 = pchanels.length;
		buttonboard.removeAllViews();
		for(int i=0;i<index1;i++)
		{
			// PChannel pchanels[i];
			//NewSClass ns = ncp.newSClasss.get(i);
			 
			//index=i;
			Button news=buildChannelButton(pchanels[i]);//new Button(this);
			
			news.setId(i);
		    if(i==0)
		    {
		    	news.setSelected(true);
		    }
		}
		if(index1>0)
		{
			PChannel ns = new PChannel();
			ns.channelname="疾病查询";
			ns.wapUrl="http://3g.39.net/jbk/index.html";
			ns.isWap=true;
			Button news=buildChannelButton(ns);
			news.setId(index1);
			
			ns = new PChannel();
			ns.channelname="检查项库";
			ns.wapUrl="http://3g.39.net/jck/index.html";
			ns.isWap=true;
			index1++;
			news=buildChannelButton(ns);
			news.setId(index1);
			
			ns = new PChannel();
			ns.channelname="症状自检";
			ns.wapUrl="http://3g.39.net/zzk/index.html";
			ns.isWap=true;
			//ns.index=index1;
			index1++;
			news=buildChannelButton(ns);
			news.setId(index1);
			
			hsv.smoothScrollTo(0, 0);//smoothScrollTo
			
			Button btn = (Button)buttonboard.findViewById(currentTabIndex);
			btn.setSelected(false);
			currentTabIndex=0;
			btn = (Button)buttonboard.findViewById(currentTabIndex);
			btn.setSelected(true);
			
			updateNewsClassItemUI();
		}
		reqAppListBusi();
	}
	
	/**
	 * @author xudeliang
	 * 更新新闻大类ui
	 */
	/*private void updateNewsClassUI(NewsClassParse ncp)
	{
		int index1 = ncp.newSClasss.size();
		for(int i=0;i<ncp.newSClasss.size();i++)
		{
			 
			NewSClass ns = ncp.newSClasss.get(i);
			 
			ns.index=i;
			Button news=buildChannelButton(ns);//new Button(this);
			
			
		    if(i==0)
		    {
		    	news.setSelected(true);
		    }
		}
		if(index1>0)
		{
			NewSClass ns = ncp.new NewSClass();
			ns.title="疾病查询";
			ns.type="http://3g.39.net/jbk/index.html";
			ns.isWap=true;
			ns.index=index1;
			index1++;
			buildChannelButton(ns);
			
			ns = ncp.new NewSClass();
			ns.title="检查项库";
			ns.type="http://3g.39.net/jck/index.html";
			ns.isWap=true;
			ns.index=index1;
			index1++;
			buildChannelButton(ns);
			
			ns = ncp.new NewSClass();
			ns.title="症状自检";
			ns.type="http://3g.39.net/zzk/index.html";
			ns.isWap=true;
			ns.index=index1;
			index1++;
			buildChannelButton(ns);
		}
		
	}*/

	/**
	 * @author xudeliang
	 * 请求资讯分类相数据,2级分类
	 * 
	 * type 表示请求的类型
	 *//*
	private void reqNewsClassItem(String type)
	{
		NewsListBusi nlb = new NewsListBusi(this);
		nlb.type=type;
		nlb.iExecute();
		CustomMessageShow.getInst().showProgressDialog(this);
	}*/
	
	
	/**
	 * @author xudeliang
	 * 更新新闻小类ui
	 */
	private void updateNewsClassItemUI()
	{
		channelview.removeAllView();
		int size = pchanels[currentTabIndex].childrens.length;
		for(int i=0;i<size;i++)
		{
        	TextView text = new TextView(this);
        	//text.setBackgroundResource(R.drawable.buttonstyle);
        	//text.setBackgroundColor(Color.parseColor("#F8F8FF"));
        	//text.setBackgroundResource(R.drawable.newslistshap);
        //	 android:background="#F8F8FF"
        	text.setText(pchanels[currentTabIndex].childrens[i].channelname);
        	text.setTag(pchanels[currentTabIndex].childrens[i]);
        	text.setGravity(Gravity.CENTER);
        	text.setTextColor(Color.parseColor("#8968CD"));
        	text.setTextSize(TypedValue.COMPLEX_UNIT_SP, 24);
        	channelview.addViewToLast(text);
		}
		channelview.onRefreshComplete();
	}
	
	
	
	/* (non-Javadoc)
	 * @see com.palmedia.framework.myinterface.UiCallBack#uiCallBack(com.palmedia.framework.business.BaseBusi)
	 */
	@Override
	public void uiCallBack(BaseBusi obj)
	{
		// TODO Auto-generated method stub
		if(obj instanceof RegistBusi)
		{
			RegistParse rp = (RegistParse)obj.getBaseStruct();
			if(rp.userid!=null && rp.userid.length()>0)
			{
				LocalData.getInst().setLocalValue("userid", rp.userid);//getLocalValue("userid")
			}
			else
			{
				RegistBusi rb =new RegistBusi(this);
				rb.imei=this.getImei();
				rb.iExecute();
			}
			Log.i("ddd","asd:"+rp.userid);
		}
		else if(obj instanceof AppListBusi)
		{
			
			applistParse = (AppListParse)obj.getBaseStruct();
			if(applistParse.appItems!=null && applistParse.appItems.size()>0)
			{
				for(int i=0;i<applistParse.appItems.size();i++)
				{
					AppItem  ai = applistParse.appItems.get(i);
					if(ai.shelves==2)
					{
						recommendAppItem=ai;
						String text = ai.appdes;//\n\n
						text=text.replace("|", "\n\n");
						StringBuffer sb=new StringBuffer();
						sb.append("应用名称："+ai.appname);
						sb.append("\n\n");
						float temsize = ai.appsize/1048576f;
						DecimalFormat df = new DecimalFormat("#0.00");
						String size = df.format(temsize);
						sb.append("大小："+size+"M");
						sb.append("\n\n");
						sb.append(text);
						//showConfirmDialog(Context context,String message,String title,String left,String right,int iconid,DialogInterface.OnClickListener l)
						dialog=CustomMessageShow.getInst().showConfirmDialog(this,sb.toString(),"软件推荐","下载",null,"取消",0,this);
						//dialog.sett
						LoadImageTsk litask = new LoadImageTsk();
						litask.setImageDownLoadListener(this);
						litask.picUrl=FrameworkConfig.getInst().getDomain()+ai.appicon;
						litask.iExcute();
						return;
					}
					
				}
				
			}
			
		}
		CustomMessageShow.getInst().cancleProgressDialog();
		if(obj instanceof HealthNewsBusi)
		{
			HealthNewsParse ncp = (HealthNewsParse)obj.getBaseStruct();
			if(ncp.pchanels!=null)
			{
				pchanels =ncp.pchanels;
			}
			
			if(null==ncp.pchanels)
			{
				CustomMessageShow.getInst().showShortToast(this,  "无频道数据，请刷新。");
			}
			else
			{
				updateHealthNewsUI();
				if(isfirst)
				{
					isfirst=false;
					CustomMessageShow.getInst().showLongToast(this, "左右拖动查看更多频道");
				}
			}
		}
		/*else if(obj instanceof NewsClassBusi)
		{
			NewsClassParse ncp = (NewsClassParse)obj.getBaseStruct();
			if(null ==ncp ||ncp.newSClasss.size()<=0)
			{
				CustomMessageShow.getInst().showShortToast(this,  "无频道数据，请刷新。");
				//this.findViewById(id)
				((Button)this.findViewById(R.id.rightbutton)).setVisibility(View.VISIBLE);
		        ((Button)this.findViewById(R.id.rightbutton)).setTextColor(Color.rgb(0,139,0));
				return;
			}
			else
			{
				reqNewsClassItem(ncp.newSClasss.get(0).type);
				updateNewsClassUI(ncp);
				((Button)this.findViewById(R.id.rightbutton)).setVisibility(View.GONE);
			}
		}
		else if(obj instanceof NewsListBusi)
		{
			NewsListParse ncp = (NewsListParse)obj.getBaseStruct();
			
			if(null ==ncp ||ncp.newsLisItems.size()<=0)
			{
				CustomMessageShow.getInst().showShortToast(this,  "无栏目数据，请重试。");
				return;
			}
			else
			{
				newsListItems.put(ncp.type, ncp.newsLisItems);
				updateNewsClassItemUI(ncp.newsLisItems);
			}
			
			if(isfirst)
			{
				isfirst=false;
				CustomMessageShow.getInst().showLongToast(this, "左右拖动查看更多频道");
			}
		}*/
	}
	
	public boolean onKeyDown(int keyCode, KeyEvent event) 
	{
		 
		if(keyCode==KeyEvent.KEYCODE_BACK && event.getRepeatCount()==0)
		{
			CustomMessageShow.getInst().showExitDialog(this,"确认退出？");
			return true;
		}
		return super.onKeyDown(keyCode, event);
	}
	
	public void rightButtonAction(View view)
	{
		reqHealthNewsBusi();
	}
	
	final int sugest = 0;//投诉
 	final int about=1;//关于
 	final int favorite=2;//收藏
 	
 	//初始化菜单
 	public boolean onCreateOptionsMenu(android.view.Menu menu)
 	{
 		super.onCreateOptionsMenu(menu);
 	    menu.add(0, sugest,0, new String("建议"));//.setIcon((R.drawable.info));
 	    menu.add(0,  about,1,new String("关于"));//.setIcon((R.drawable.exit));
 	   menu.add(0,  favorite,2,new String("收藏"));//.setIcon((R.drawable.exit));
 		return true;
 	}
 	
    public boolean onPrepareOptionsMenu(android.view.Menu menu)
    {
    	return true;
    }
    
    public boolean onOptionsItemSelected(android.view.MenuItem item)
    {
 		switch (item.getItemId())
 		{
 			case favorite:
 			{
 				Intent intent=new Intent();
			   	intent.setClass(this,FavoriteActivity.class);
			   	startActivity(intent);
 				break;
 			}
 			case about:
 			{
 				Intent intent=new Intent();
			   	intent.setClass(this,HelpInfoAct.class);
			   	startActivity(intent);
 				break;
 			}
 			
 			case sugest:
 				UMFeedbackService.openUmengFeedbackSDK(this);
 				//UMFeedbackService.openUmengFeedbackSDK(this);
 				break;
 				
 		}
 		return true;
    }
    
    @Override
    public void onResume() 
    {
    	// 返回结果在回调函数getUpdatePoints(...)中处理
		AppConnect.getInstance(this).getPoints(this);
    	super.onResume();
    	MobclickAgent.onResume(this);
    }
    
    @Override
    public void onPause() 
    { 
    	super.onPause(); 
    	MobclickAgent.onPause(this); 
    	
    }
    @Override
	protected void onDestroy() {
		AppConnect.getInstance(this).finalize();
		super.onDestroy();
	}

	/* (non-Javadoc)
	 * @see android.view.View.OnClickListener#onClick(android.view.View)
	 */
	@Override
	public void onClick(View v)
	{
		PChannel nc = (PChannel)v.getTag();
		if(nc.isWap)
		{
			Bundle bundle=new Bundle();
			Intent intent=new Intent();
			intent.putExtra("bundle",bundle);
			String newurl =  nc.wapUrl;
			bundle.putString("url",newurl);
			bundle.putString("title",nc.channelname);
			intent.setClass(this,WebViewActivity.class);
			startActivity(intent);
			return;
		}
		
		if(currentTabIndex==v.getId())
		{
			return;
		}
		
		Button btn = (Button)buttonboard.findViewById(currentTabIndex);
		btn.setSelected(false);
		v.setSelected(true);
		
		currentTabIndex = v.getId();//nc.index;
		
		channelview.removeAllView();
		if(null!=pchanels && pchanels.length>currentTabIndex
				&& pchanels[currentTabIndex]!=null 
				&& pchanels[currentTabIndex].childrens!=null 
				&& pchanels[currentTabIndex].childrens.length>0)
		{
			//有数据则初始化
			updateNewsClassItemUI();
		}
		else
		{
			CustomMessageShow.getInst().showShortToast(this,  "无数据，请刷新。");
		}
	}




	/* (non-Javadoc)
	 * @see com.palmedia.framework.common.ImageDownLoadListener#OnImageDownFinish(android.graphics.Bitmap, java.lang.String)
	 */
	@Override
	public void OnImageDownFinish(Bitmap arg0, String arg1)
	{
		// TODO Auto-generated method stub
		if(null!=arg0 && dialog.isShowing())
		{
			Drawable drawable = new BitmapDrawable(this.getResources(),arg0); 
			dialog.setIcon(drawable);
		}
		
	}




	/* (non-Javadoc)
	 * @see android.content.DialogInterface.OnClickListener#onClick(android.content.DialogInterface, int)
	 */
	@Override
	public void onClick(DialogInterface dialog, int which)
	{
		// TODO Auto-generated method stub
		if(which==DialogInterface.BUTTON_POSITIVE)
		{
			Util.openBrowser(this, FrameworkConfig.getInst().getDomain()+recommendAppItem.apppath);
		}
		
		
	}




	/* (non-Javadoc)
	 * @see com.waps.UpdatePointsNotifier#getUpdatePoints(java.lang.String, int)
	 
	@Override
	public void getUpdatePoints(String arg0, int arg1)
	{
		// TODO Auto-generated method stub
		
	}




	 (non-Javadoc)
	 * @see com.waps.UpdatePointsNotifier#getUpdatePointsFailed(java.lang.String)
	 
	@Override
	public void getUpdatePointsFailed(String arg0)
	{
		// TODO Auto-generated method stub
		
	}*/
	
	/**
	 * AppConnect.getPoints()方法的实现，必须实现
	 * 
	 * @param currencyName
	 *            虚拟货币名称.
	 * @param pointTotal
	 *            虚拟货币余额.
	 */
	public void getUpdatePoints(String currencyName, int pointTotal) {
		//this.currencyName = currencyName;
		//displayPointsText = currencyName + ": " + pointTotal;
		//mHandler.post(mUpdateResults);
		this.currentName=currencyName;
		this.point=pointTotal;
	}

	/**
	 * AppConnect.getPoints() 方法的实现，必须实现
	 * 
	 * @param error
	 *            请求失败的错误信息
	 */
	public void getUpdatePointsFailed(String error) {
		//displayPointsText = error;
		//mHandler.post(mUpdateResults);
		getPointError=error;
		mHandler.post(mUpdateResults);
	}
	// 创建一个线程
	final Runnable mUpdateResults = new Runnable() {
		public void run() {
			if (getPointError != null) {
				CustomMessageShow.getInst().showShortToast(HealthShareActivity.this,  getPointError);
			}
		}
	};
	
	//获取imei号
	private String getImei()
	{
		TelephonyManager tm =(TelephonyManager)getSystemService(TELEPHONY_SERVICE);//  
		//IMSI=tm.getSimSerialNumber();
		String IMEI=tm.getDeviceId();
		
		return IMEI;
	}
	
	public void backButtonAction(View view)
	{
		//Bundle bundle=new Bundle();
		Intent intent=new Intent();
		//intent.putExtra("articlebundle",bundle);
		//TitleListItem nli = (TitleListItem)v.getTag();
		
		//bundle.putString("articleid",articleid);
	   	intent.setClass(this,PublishActivity.class);
	   	this.startActivity(intent);
	}
	
	 /*<com.palmedia.framework.ui.CustomImageView
     android:id="@+id/image_item_image"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:layout_marginBottom="1dp"
     android:layout_marginLeft="1dp"
     android:layout_marginRight="1dp"
     android:layout_marginTop="1dp"
     android:layout_gravity="center"	       
     />*/
}